package com.dodock.banglapapers.server;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.dodock.banglapapers.server.generator.DDNGetNewsPapersGenerator;

@SuppressWarnings("serial")
public class DDNGetNewspapers extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
	
		resp.setContentType("application/json");
		resp.setCharacterEncoding("UTF-8");
		
		boolean notice = false;
		String appType = req.getParameter("appType");
		if(appType == null || appType.equals("iOS") == false){
			String appVersion = req.getParameter("appVersion");
			if(appVersion == null || appVersion.equals("2.5.1") == false){
				notice = true;
			}
		}
		
		
		resp.getWriter().write(DDNGetNewsPapersGenerator.Generate(notice));
	}
	
}
